import request from 'src/axios'

/**
 * @description 分页查询流转条件
 * @param { Object } params 查询参数
 * @returns Promise
 */
export const pageForm = (params: object) => {
  return request.get('/flow/flowForm/page', { params })
}

/**
 * @description 查看流转条件
 * @param { String } id 主键
 * @returns Promise
 */
export const viewForm = (id: string) => {
  return request.get('/flow/flowForm', { params: { id } })
}

/**
 * @description 新增流转条件
 * @param { Object } data 新增数据
 * @returns Promise
 */
export const saveForm = (data: object) => {
  return request.post('/flow/flowForm', data)
}

/**
 * @description 修改流转条件
 * @param { Object } data 修改数据
 * @returns Promise
 */
export const updateForm = (data: object) => {
  return request.put('/flow/flowCondition', data)
}

/**
 * @description 删除流转条件
 * @param { Array<string> } ids 主键数组
 * @returns Promise
 */
export const deleteForm = (ids: Array<string>) => {
  return request.delete('/flow/flowForm', { data: ids })
}

/**
 * @description 启用流转条件
 * @param { String } id 主键
 * @returns Promise
 */
export const enableForm = (id: string) => {
  return request.put('/flow/flowForm/enable', { id })
}

/**
 * @description 禁用流转条件
 * @param { String } id 主键
 * @returns Promise
 */
export const disableForm = (id: string) => {
  return request.put('/flow/flowForm/disable', { id })
}
